using System;
using System.Collections.Generic;
using System.Text;
using CMS.Core.DataInterfaces;
using CMS.Presenters.Views.ListManager;
using AjaxPro;
using System.Collections;
using CMS.Data;

namespace CMS.Presenters.Presenters.ListManager
{
    public class BaoCaoTiepDanPresenter
    {
        ITiepDanDao iTiepDanDao;
        IBaoCaoTiepDanView iBaoCaoTiepDanView;

        public BaoCaoTiepDanPresenter()
        { 
        
        }

        public BaoCaoTiepDanPresenter(IBaoCaoTiepDanView iBaoCaoTiepDanView)
        {
            this.iBaoCaoTiepDanView = iBaoCaoTiepDanView;
            this.iBaoCaoTiepDanView.LinhVucs = new LinhVucDao().GetFieldEqualCriteria("TrangThai", true);
            this.iBaoCaoTiepDanView.DiaBans = new DiaBanDao().GetFieldEqualCriteria("TrangThai", true);
            this.iBaoCaoTiepDanView.LoaiHinhs = new LoaiHinhDao().GetFieldEqualCriteria("TrangThai", true);
        }

        [AjaxMethod]
        public IList SearchTiepDans(string type, String txtTuNgay, String txtDenNgay, int maDiaBan, 
            int maLinhVuc, int maLoaiHinh, int min, int max)
        {
            this.iTiepDanDao = new TiepDanDao();
            return this.iTiepDanDao.SearchTiepDans(type, txtTuNgay, txtDenNgay, maDiaBan, maLinhVuc, maLoaiHinh, min, max);
        }

        [AjaxMethod]
        public int TotalSearchTiepDans(string type, String txtTuNgay, String txtDenNgay, int maDiaBan,
            int maLinhVuc, int maLoaiHinh)
        {
            this.iTiepDanDao = new TiepDanDao();
            return this.iTiepDanDao.TotalSearchTiepDans(type, txtTuNgay, txtDenNgay, maDiaBan, maLinhVuc, maLoaiHinh);
        }  
    }
}
